//package com.itcast.cheetah.rabbitmq.config;
//
//import com.itcast.cheetah.rabbitmq.component.MQReciever;
//import org.springframework.amqp.core.AcknowledgeMode;
//import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
//import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * @className: MessageListenerConfig
// * @description: 消息监听配置类
// * @author: cheetah
// * @date: 2022/2/9 15:50
// * @Version: 1.0
// */
//@Configuration
//public class MessageListenerConfig {
//
//    @Autowired
//    private CachingConnectionFactory connectionFactory;
//
//    @Autowired
//    private MQReciever mqReciever;//消息接收处理类
//
//    @Bean
//    public SimpleMessageListenerContainer simpleMessageListenerContainer(){
//        SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
//        //并发使用者的数量
//        container.setConcurrentConsumers(1);
//        //消费者人数上限
//        container.setMaxConcurrentConsumers(1);
//        container.setAcknowledgeMode(AcknowledgeMode.MANUAL); // RabbitMQ默认是自动确认，这里改为手动确认消息
//        //设置一个队列，此处支持设置多个
//        container.setQueueNames("directQueue");
//        container.setMessageListener(mqReciever);
//        return container;
//    }
//
//}
